package com.yunjing.mvparmsdemo.mvp.api;


import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.HttpUrl;

public class MultiUrlManager {

    private static volatile MultiUrlManager singleton;

    private MultiUrlManager() {
    }

    public static MultiUrlManager getInstance() {
        if (singleton == null) {
            synchronized (MultiUrlManager.class) {
                if (singleton == null) {
                    singleton = new MultiUrlManager();
                }
            }
        }
        return singleton;
    }

    public void initMultiUrl() {
        HttpUrl httpUrl = RetrofitUrlManager.getInstance().fetchDomain(Api.INPUT_HTTP_URL_NAME);
        if ((httpUrl == null || !httpUrl.toString().equals(Api.NewBaseUrl))) {
            RetrofitUrlManager.getInstance().putDomain(Api.INPUT_HTTP_URL_NAME, Api.NewBaseUrl);
        }
    }
}